/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.user;

import model.Campaign;
import java.util.ArrayList;
import java.util.Iterator;
import model.Resource;

/**
 *
 * @author CUNEYT
 */
public class Director extends User {

    private ArrayList<Campaign> campaigns = null;
    private ArrayList<Resource> resources = null;
    private ArrayList<Staff> staff = null;
    private String department = null;

    public Director(String name, String surname, String username, char[] password) {
        super(name, surname, username, password, User.DIRECTOR);
        campaigns = new ArrayList<Campaign>();
        resources = new ArrayList<Resource>();
        staff = new ArrayList<Staff>();
    }

    public Director(String name, String surname, String username, char[] password, String dep) {
        super(name, surname, username, password, User.DIRECTOR);
        department = dep;
        campaigns = new ArrayList<Campaign>();
        resources = new ArrayList<Resource>();
        staff = new ArrayList<Staff>();
    }

    public ArrayList<Staff> getStaff() {
        return staff;
    }

    public void setStaff(ArrayList<Staff> staff) {
        this.staff = staff;
    }

    public ArrayList<Resource> getResources() {
        return resources;
    }

    public void setResources(ArrayList<Resource> resources) {
        this.resources = resources;
    }

    public ArrayList<Campaign> getCampaigns() {
        return campaigns;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public void setCampaigns(ArrayList<Campaign> campaigns) {
        this.campaigns = campaigns;
        setChanged();
        notifyObservers(this);
    }

    public void addCampaign(Campaign cam) {
        this.campaigns.add(cam);
        setChanged();
        notifyObservers(this);
    }

    public ArrayList<Campaign> lookupCampaigns(String type) {
        ArrayList<Campaign> result = new ArrayList<Campaign>();
        for (Iterator<Campaign> it = campaigns.iterator(); it.hasNext();) {
            Campaign campaign = it.next();
            if (campaign.getStatus().equals(type)) {
                result.add(campaign);
            }
        }
        return result;
    }
}
